package com.piepesken.mediscale.ui.weigh

import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import com.piepesken.mediscale.R
import com.piepesken.mediscale.viewmodels.ScaleViewModel

@Composable
fun WeightScreen(
    navController: NavController,
    deviceId: String?
) {
    if (deviceId == null) {
        Column {
            Text(text = stringResource(id = R.string.anErrorOccurred))
        }
        return
    }

    val viewModel: ScaleViewModel = hiltViewModel()
    val messages = viewModel.getDeviceMessages(deviceId).collectAsState(initial = emptyList())

    println(messages.value)

    Column {
        messages.value
    }
}